package com.wego.mapper;

import com.wego.domain.entity.User;
import com.wego.domain.query.UserQuery;
import com.wego.domain.vo.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface UserMapper {
    @Select("select id,user.create_time as createTime,user.update_time as updateTime,nickname,account,password,avatar,state,user.game_age as gameAge,gender,birthday from user order by update_time desc")
    List<UserVO> selectList();
    /**
     * 根据ID批量删除员工的基本信息
     */
    int deleteByIds(List<Integer> ids);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int batchInsert(@Param("list") List<User> list);

    /**
     * 根据条件查询用户信息
     */
    List<User> selectWithCondition(UserQuery query);

    /**
     * 根据账号查询用户信息
     * @param account 账号
     * @return 用户对象
     */
    User selectByAccount(String account);

    /**
     * 根据账号查询用户数量
     * @param account
     * @return
     */
    int selectCountByAccount(String account);

    /**
     * 根据主键查询用户昵称
     * @param id 用户主键ID
     * @return 用户昵称
     */
    String selectNicknameById(Integer id);

    Integer selectUserIdByAccount(String account);
}